{% comment %}
  移动端手风琴样式导航
    
  Accepts:
{% endcomment %}
<div class="nav-expand">
  <ul class="container {{ background_color }} list-unstyled w-100 mb-0 nav-menu {{ nav_menu_padding_top }} flex-column d-flex {{ show_box_shaw }}">
    <li class="d-flex flex-grow-0">
      <ul class="d-flex flex-column list-unstyled w-100 px-0 nav-link-container">
        {%- for link in linklists[section.settings.main_menu].links -%}
          {% comment %}一级导航栏内没二级{% endcomment %}
          {% if link.levels == 0 %}
            <li class="nav-item nav-link-wrap ">
              <a {% render 'link', link: link.url %} class="nav-link {{ hover_style }} d-flex small nav-fw" href="{{ link.url }}">
                <span class="position-relative text-outline">{{ link.title }}</span>
              </a>
            </li>
          {% comment %}一级导航栏内有二级{% endcomment %}
          {% elsif link.levels >= 1 %}
            {% comment %}判断配置的图片链接是否有跟三级菜单链接相同的{% endcomment %}
            {% liquid 
              assign thirdmenu_links = link.links | map: "links" | map: "url"
              assign block_links = section.blocks | where: "type", "mega_menu" | map: "settings" | map: 'link'
              assign is_flag = false 
              for thirdmenu_link in thirdmenu_links
                for block_link in block_links
                  if thirdmenu_link == block_link
                    assign is_flag = true
                    break
                  endif
                endfor
              endfor
            %}
            {% comment %}一级导航栏{% endcomment %}
            <li class="nav-item cursor-pointer as-dropdown dropdown d-flex flex-column justify-content-start {% if is_flag == false %} position-relative{% endif %}" tabindex="0">
              <a id="dropdownMenuLink{{ forloop.index }}"
                class="nav-link {{ hover_style }} dropdown-toggle small nav-fw" data-bs-toggle="dropdown" 
                aria-expanded="false">
                <span class="text-outline">{{ link.title }}</span>
                <span class="dropdown-icon">{% render 'icon-chevron-down' %}</span>             
              </a>
  
              {% render 'header-dropdown-menu-v2', is_flag: is_flag, link: link, background_color: background_color, if_first: forloop.first, is_desktop_logo_top_left: is_desktop_logo_top_left  %}
              
            </li>
          {% endif %}
        {%- endfor -%}
      </ul>
    </li>
  </ul>
</div>

